/* estilos.css */

/* ========== ESTILOS GENERALES ========== */
body {
  margin: 0;
  padding: 0;
  overflow: hidden;
}

/* Para ocultar elementos del menú */
.d-none {
  display: none;
}

/* ========== SIDEBAR ========== */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 390px;
  height: 100vh;
  background: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 100%);
  box-shadow: 2px 0 10px rgba(0,0,0,0.1);
  z-index: 1000;
  overflow-y: auto;
  padding: 20px;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar oculto */
.sidebar.hidden {
  transform: translateX(-100%);
}

@media (max-width: 768px) {
  .sidebar.hidden {
    left: -100%;
    transform: none;
  }
}

.sidebar::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-track {
  background: #e9ecef;
}

.sidebar::-webkit-scrollbar-thumb {
  background: #0d6efd;
  border-radius: 4px;
}

.sidebar h4 {
  color: #0d6efd;
  font-weight: 600;
  margin-bottom: 20px;
  margin-top: 10px;
  padding-bottom: 10px;
  padding-right: 50px; /* Espacio para el botón de cerrar */
  border-bottom: 3px solid #0d6efd;
}

.sidebar h5 {
  color: #495057;
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 15px;
}

.sidebar h6 {
  color: #6c757d;
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 10px;
}

/* ========== MAIN CONTENT ========== */
.main-content {
  margin-left: 390px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #c6cbcd;
  transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Main content expandido cuando sidebar está oculto */
.main-content.expanded {
  margin-left: 0;
}

@media (max-width: 768px) {
  .main-content {
    margin-left: 0;
  }
}

/* ========== BARRA DE INFORMACIÓN ESTILO GOLLY ========== */
.info-bar {
  background: #fffacd; /* Amarillo claro estilo Golly */
  border-bottom: 2px solid #daa520;
  padding: 8px 15px;
  font-family: 'Courier New', Consolas, Monaco, monospace;
  font-size: 14px;
  color: #000;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  overflow-x: auto;
  white-space: nowrap;
}

.info-bar-content {
  display: flex;
  align-items: center;
  justify-content: center; /* Centrar contenido */
  gap: 8px;
  flex-wrap: nowrap;
}

.info-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.info-label {
  font-weight: bold;
  color: #333;
}

.info-value {
  color: #000;
  background: rgba(255, 255, 255, 0.5);
  padding: 2px 6px;
  border-radius: 3px;
  min-width: 60px;
  text-align: center;
}

.info-separator {
  color: #999;
  padding: 0 4px;
  font-weight: bold;
}

/* Responsive para info bar */
@media (max-width: 768px) {
  .info-bar {
    font-size: 11px;
    padding: 6px 10px;
  }

  .info-value {
    min-width: 40px;
    font-size: 10px;
  }

  .info-bar-content {
    gap: 4px;
  }
}

/* ========== CANVAS Y WRAPPER ========== */
.canvas-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.canvas-container {
  width: 100%;
  max-width: 1300px;
  height: 800px;
  border: 1px solid black;
  position: relative;
  overflow: hidden;
}

#simuladorCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

#minimapa {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 100;
  border: 2px solid #0d6efd;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* ========== BARRA DE CONTROL DEL CANVAS ========== */
#canvasControlBar {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95);
  padding: 15px 20px;
  border-radius: 50px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 100;
  backdrop-filter: blur(10px);
}

#controlBar .btn {
  margin: 0 5px;
  border-radius: 20px;
  font-weight: 500;
}

#velocidadValor {
  margin-bottom: 0;
}

#velocidadSlider {
  border: solid 1px #82CFD0;
  border-radius: 10px;
  color: rgba(0, 0, 0, 0.95);
}

/* ========== GRÁFICAS Y CONTENEDORES ========== */
.chart-container {
  margin-bottom: 15px;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 12px;
  background: white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  transition: transform 0.2s, box-shadow 0.2s;
  overflow: hidden; /* FIX: Evita desbordamiento */
}

.chart-container:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* FIX: Asegurar que los divs de plotly se ajusten */
.chart-container > div {
  width: 100% !important;
  max-width: 100%;
}

.param-section {
  background: white;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  margin-bottom: 20px;
}

/* ========== FORMULARIOS ========== */
.form-label {
  font-weight: 500;
  color: #495057;
  margin-top: 10px;
}

/* ========== BOTONES ========== */
.btn-primary {
  background: #0d6efd;
  border: none;
  font-weight: 500;
  padding: 10px;
  transition: all 0.3s;
}

.btn-primary:hover {
  background: #0b5ed7;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(13, 110, 253, 0.3);
}

.btn-warning {
  background: #ffc107;
  border: none;
  color: #000;
}

.btn-warning:hover {
  background: #ffb300;
}

.btn-success {
  background: #198754;
  border: none;
}

.btn-success:hover {
  background: #157347;
}

/* ========== MODO EDICIÓN ========== */
.edit-mode-badge {
  display: none;
  background: #ffc107;
  color: #000;
  padding: 8px 15px;
  border-radius: 20px;
  font-weight: bold;
  font-size: 0.85rem;
  margin-bottom: 15px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(255, 193, 7, 0.4);
  animation: pulse 2s infinite;
}

.edit-mode-badge.active {
  display: block;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.advanced-settings {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  margin-top: 10px;
}

.advanced-settings.show {
  max-height: 500px;
}

.coordinate-input {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

.coordinate-input label {
  min-width: 60px;
  font-weight: 500;
}

/* Handles visuales en el canvas */
.edit-handle {
  position: absolute;
  display: none !important; /* Forzar que estén ocultos por defecto */
  z-index: 150;
  pointer-events: auto;
}

.edit-handle.active {
  display: flex !important; /* Forzar que se muestren cuando están activos */
}

.move-handle {
  width: 40px;
  height: 40px;
  background: #0d6efd;
  border: 3px solid white;
  border-radius: 50%;
  cursor: move;
  box-shadow: 0 4px 12px rgba(13, 110, 253, 0.5);
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
  font-weight: bold;
}

.move-handle::before {
  content: "✥";
}

.rotate-handle {
  width: 40px;
  height: 40px;
  background: #198754;
  border: 3px solid white;
  border-radius: 50%;
  cursor: grab;
  box-shadow: 0 4px 12px rgba(25, 135, 84, 0.5);
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
  font-weight: bold;
}

.rotate-handle::before {
  content: "↻";
}

.rotate-handle:active {
  cursor: grabbing;
}

/* ========== PANTALLA DE CARGA ========== */
#loadingScreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease-out;
}

#loadingScreen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loading-content {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 40px;
  max-width: min(900px, 85vw);
  max-height: 90vh;
  width: 90%;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.6s ease-out;
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.loading-header {
  text-align: center;
  margin-bottom: 30px;
}

.loading-header h1 {
  color: #667eea;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  margin-bottom: 10px;
  font-weight: 700;
}

.loading-header p {
  color: #6c757d;
  font-size: clamp(1rem, 2vw, 1.1rem);
}

.loading-spinner {
  display: flex;
  justify-content: center;
  margin: 30px 0;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #e9ecef;
  border-top: 5px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.instructions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
  gap: 15px;
  margin-top: 30px;
}

.instruction-card {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 12px;
  border-left: 4px solid #667eea;
  transition: transform 0.2s;
}

.instruction-card:hover {
  transform: translateX(5px);
}

.instruction-card h3 {
  color: #667eea;
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.instruction-card p {
  color: #495057;
  font-size: clamp(0.85rem, 1.5vw, 0.95rem);
  margin: 0;
  line-height: 1.5;
}

.loading-progress {
  margin-top: 20px;
  text-align: center;
}

.progress-bar-custom {
  width: 100%;
  height: 8px;
  background: #e9ecef;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  width: 0%;
  transition: width 0.3s ease;
  animation: progressPulse 1.5s ease-in-out infinite;
}

@keyframes progressPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.loading-status {
  color: #6c757d;
  font-size: 0.9rem;
  font-weight: 500;
}

/* Media queries para pantalla de carga responsive */
@media (min-width: 1920px) {
  .loading-content {
    max-width: 900px;
    padding: 40px;
  }

  .loading-header h1 {
    font-size: 2.5rem;
  }

  .instructions {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .loading-content {
    padding: 25px;
    max-width: 95vw;
  }

  .loading-header h1 {
    font-size: 1.8rem;
  }

  .loading-header p {
    font-size: 1rem;
  }

  .instructions {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .instruction-card {
    padding: 12px;
  }

  .spinner {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 480px) {
  .loading-content {
    padding: 20px;
    border-radius: 15px;
  }

  .loading-header h1 {
    font-size: 1.5rem;
  }

  .loading-header p {
    font-size: 0.9rem;
  }

  .instruction-card h3 {
    font-size: 0.95rem;
  }

  .instruction-card p {
    font-size: 0.85rem;
  }
}

/* ========== ACCORDIONS ========== */
.accordion {
  margin-top: 20px;
}

.accordion-item {
  border: none;
  margin-bottom: 10px;
  border-radius: 8px !important;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.accordion-button {
  background: white;
  color: #495057;
  font-weight: 600;
  padding: 15px 20px;
  border: none;
  box-shadow: none !important;
}

.accordion-button:not(.collapsed) {
  background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%);
  color: white;
}

.accordion-button:hover {
  background: #f8f9fa;
}

.accordion-button:not(.collapsed):hover {
  background: linear-gradient(135deg, #0b5ed7 0%, #0a58ca 100%);
}

.accordion-button::after {
  filter: none;
}

.accordion-button:not(.collapsed)::after {
  filter: brightness(0) invert(1);
}

.accordion-body {
  padding: 20px;
  background: white;
}

.accordion-collapse {
  border-top: 2px solid #e9ecef;
}

/* FIX: Ajuste especial para accordion de métricas */
#collapseMetrics .accordion-body {
  padding: 15px 10px;
}

#collapseMetrics .chart-container {
  margin-left: 0;
  margin-right: 0;
}

/* ========== MODAL ========== */
.modal-content {
  border-radius: 15px;
  border: none;
}

.modal-header {
  border-radius: 15px 15px 0 0;
  border-bottom: none;
  padding: 20px 25px;
}

.modal-body {
  padding: 25px;
}

.modal-footer {
  border-top: 1px solid #e9ecef;
  padding: 15px 25px;
}

.card {
  transition: transform 0.2s, box-shadow 0.2s;
  height: 100%;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .sidebar {
    left: -380px;
  }

  .sidebar.open {
    left: 0;
  }

  .main-content {
    margin-left: 0;
  }

  .sidebar-toggle {
    display: block;
    position: fixed;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 999;
    background: #0d6efd;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
    box-shadow: 2px 0 5px rgba(0,0,0,0.2);
  }

  .sidebar-toggle:hover {
    background: #0b5ed7;
  }
}

/* ========== BOTÓN TOGGLE DENTRO DEL SIDEBAR ========== */
.sidebar-toggle-inner {
  position: absolute;
  top: 15px;
  right: 15px;
  z-index: 1002;
  background: rgba(13, 110, 253, 0.1);
  color: #0d6efd;
  border: 2px solid #0d6efd;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1;
  transition: all 0.3s ease;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-toggle-inner svg {
  stroke: #0d6efd;
  transition: stroke 0.3s ease, transform 0.3s ease;
  width: 20px;
  height: 20px;
  display: block;
  flex-shrink: 0;
  will-change: transform;
}

.sidebar-toggle-inner:hover {
  background: #0d6efd;
  transform: scale(1.1);
}

.sidebar-toggle-inner:hover svg {
  stroke: white;
}

.sidebar-toggle-inner:active {
  transform: scale(0.95);
}

/* El botón interno se mueve con el sidebar (no necesita ocultarse) */
/* Se oculta automáticamente cuando el sidebar sale de la pantalla */

/* ========== BOTÓN FLOTANTE (CUANDO SIDEBAR ESTÁ OCULTO) ========== */
.sidebar-toggle-float {
  position: fixed;
  left: 0;
  top: 45px; /* Justo debajo de la info-bar que tiene ~40-45px de altura */
  z-index: 1001;
  background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%);
  color: white;
  border: none;
  border-radius: 0 8px 8px 0;
  padding: 15px 10px;
  cursor: pointer;
  box-shadow: 3px 0 15px rgba(0,0,0,0.3);
  font-size: 24px;
  line-height: 1;
  transition: all 0.3s ease;
  width: 50px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse-horizontal 2s infinite;
}

.sidebar-toggle-float:hover {
  background: linear-gradient(135deg, #0b5ed7 0%, #0a58ca 100%);
  transform: translateX(5px);
  box-shadow: 4px 0 20px rgba(0,0,0,0.4);
  animation: none;
}

.sidebar-toggle-float:active {
  transform: scale(0.95);
}

@keyframes pulse-horizontal {
  0%, 100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(5px);
  }
}

/* Responsivo para móviles */
@media (max-width: 768px) {
  .sidebar-toggle-inner {
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .sidebar-toggle-float {
    top: 40px; /* Ajuste para info-bar en móviles */
    width: 45px;
    height: 60px;
    font-size: 20px;
  }
}

/* Ajuste fino para pantallas muy pequeñas */
@media (max-width: 480px) {
  .sidebar-toggle-float {
    top: 38px; /* Info-bar más compacta en móviles pequeños */
  }
}

/* ========== ESTILOS PARA VÉRTICES ========== */
.vertex-info {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    pointer-events: none;
}

.btn-outline-info:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.curve-mode-active {
    border-left: 4px solid #17a2b8 !important;
    background: rgba(23, 162, 184, 0.05);
}

/* ========== CURSOR PERSONALIZADO PARA VÉRTICES ========== */
#simuladorCanvas.editing-vertices {
    cursor: crosshair;
}

#simuladorCanvas.dragging-vertex {
    cursor: grabbing !important;
}

/* Efecto hover en vértices */
.vertex-hover {
    filter: drop-shadow(0 0 8px rgba(255, 165, 0, 0.8));
    cursor: grab;
}

/* ========================================== */
/* ========== MODO OSCURO (DARK MODE) ====== */
/* ========================================== */

/* Clase principal para modo oscuro */
body.dark-mode {
    background-color: #1a1a1a;
    color: #e0e0e0;
}

/* Sidebar en modo oscuro */
body.dark-mode .sidebar {
    background: linear-gradient(180deg, #2b2b2b 0%, #1f1f1f 100%);
    box-shadow: 2px 0 10px rgba(0,0,0,0.5);
}

body.dark-mode .sidebar::-webkit-scrollbar-track {
    background: #1f1f1f;
}

body.dark-mode .sidebar::-webkit-scrollbar-thumb {
    background: #5a9fd4;
    border-radius: 4px;
}

body.dark-mode .sidebar h4 {
    color: #5a9fd4;
    border-bottom: 3px solid #5a9fd4;
}

body.dark-mode .sidebar h5 {
    color: #b8b8b8;
}

body.dark-mode .sidebar h6 {
    color: #9a9a9a;
}

/* Main content en modo oscuro */
body.dark-mode .main-content {
    background: #252525;
}

/* Info bar en modo oscuro */
body.dark-mode .info-bar {
    background: #2a2a1a;
    border-bottom-color: #555;
    color: #e0e0e0;
}

body.dark-mode .info-label {
    color: #aaa;
}

body.dark-mode .info-value {
    background: rgba(0, 0, 0, 0.3);
    color: #e0e0e0;
}

body.dark-mode .info-separator {
    color: #666;
}

/* Canvas y wrapper en modo oscuro */
body.dark-mode .canvas-container {
    border: 1px solid #444;
    background-color: #1a1a1a;
}

body.dark-mode #simuladorCanvas {
    background-color: #2a2a2a;
}

/* Acordeón en modo oscuro */
body.dark-mode .accordion-item {
    background-color: #2b2b2b;
    border-color: #444;
}

body.dark-mode .accordion-button {
    background-color: #333;
    color: #e0e0e0;
    border-color: #444;
}

body.dark-mode .accordion-button:not(.collapsed) {
    background-color: #3d5a80;
    color: #fff;
}

body.dark-mode .accordion-button:hover {
    background-color: #3a3a3a;
}

body.dark-mode .accordion-button:focus {
    box-shadow: 0 0 0 0.25rem rgba(90, 159, 212, 0.25);
}

body.dark-mode .accordion-body {
    background-color: #2b2b2b;
    color: #d0d0d0;
}

/* Formularios en modo oscuro */
body.dark-mode .form-label {
    color: #c0c0c0;
}

body.dark-mode .form-control,
body.dark-mode .form-select {
    background-color: #333;
    border-color: #555;
    color: #e0e0e0;
}

body.dark-mode .form-control:focus,
body.dark-mode .form-select:focus {
    background-color: #3a3a3a;
    border-color: #5a9fd4;
    color: #e0e0e0;
    box-shadow: 0 0 0 0.25rem rgba(90, 159, 212, 0.25);
}

body.dark-mode .form-control::placeholder {
    color: #888;
}

/* Botones en modo oscuro */
body.dark-mode .btn-primary {
    background-color: #3d5a80;
    border-color: #3d5a80;
}

body.dark-mode .btn-primary:hover {
    background-color: #5a9fd4;
    border-color: #5a9fd4;
}

body.dark-mode .btn-danger {
    background-color: #8b3838;
    border-color: #8b3838;
}

body.dark-mode .btn-danger:hover {
    background-color: #b84848;
    border-color: #b84848;
}

body.dark-mode .btn-success {
    background-color: #2d5a3d;
    border-color: #2d5a3d;
}

body.dark-mode .btn-success:hover {
    background-color: #3d7a4d;
    border-color: #3d7a4d;
}

body.dark-mode .btn-info {
    background-color: #2d4a5a;
    border-color: #2d4a5a;
}

body.dark-mode .btn-info:hover {
    background-color: #3d6a7a;
    border-color: #3d6a7a;
}

body.dark-mode .btn-warning {
    background-color: #8b6f38;
    border-color: #8b6f38;
}

body.dark-mode .btn-warning:hover {
    background-color: #b89f48;
    border-color: #b89f48;
}

body.dark-mode .btn-secondary {
    background-color: #4a4a4a;
    border-color: #4a4a4a;
}

body.dark-mode .btn-secondary:hover {
    background-color: #5a5a5a;
    border-color: #5a5a5a;
}

/* Alertas en modo oscuro */
body.dark-mode .alert-info {
    background-color: #1e3a4a;
    border-color: #2d5a6a;
    color: #c0d8e8;
}

body.dark-mode .alert-warning {
    background-color: #4a3a1e;
    border-color: #6a5a2d;
    color: #e8d8c0;
}

body.dark-mode .alert-danger {
    background-color: #4a1e1e;
    border-color: #6a2d2d;
    color: #e8c0c0;
}

body.dark-mode .alert-success {
    background-color: #1e4a2d;
    border-color: #2d6a3d;
    color: #c0e8d0;
}

/* Badge de modo edición en modo oscuro */
body.dark-mode .edit-mode-badge {
    background-color: #3d5a80;
    color: #fff;
    border-color: #5a9fd4;
}

/* Handles de edición en modo oscuro */
body.dark-mode .move-handle {
    background-color: #3d5a80;
    border-color: #5a9fd4;
}

body.dark-mode .rotate-handle {
    background-color: #8b3838;
    border-color: #b84848;
}

/* Botones toggle en modo oscuro */
body.dark-mode .sidebar-toggle-inner {
    background: rgba(93, 159, 212, 0.2);
    color: #5d9fd4;
    border-color: #5d9fd4;
}

body.dark-mode .sidebar-toggle-inner svg {
    stroke: #5d9fd4;
}

body.dark-mode .sidebar-toggle-inner:hover {
    background: #5d9fd4;
}

body.dark-mode .sidebar-toggle-inner:hover svg {
    stroke: #1a1a2e;
}

body.dark-mode .sidebar-toggle-float {
    background: linear-gradient(135deg, #3d5a80 0%, #2d4a70 100%);
    box-shadow: 3px 0 15px rgba(0,0,0,0.6);
}

body.dark-mode .sidebar-toggle-float:hover {
    background: linear-gradient(135deg, #5a9fd4 0%, #4a8fc4 100%);
}

/* Text muted en modo oscuro */
body.dark-mode .text-muted {
    color: #888 !important;
}

/* KBD (keyboard tags) en modo oscuro */
body.dark-mode kbd {
    background-color: #3a3a3a;
    color: #e0e0e0;
    border: 1px solid #555;
    box-shadow: inset 0 -1px 0 rgba(0,0,0,0.5);
}

/* Modal en modo oscuro */
body.dark-mode .modal-content {
    background-color: #2b2b2b;
    color: #e0e0e0;
    border-color: #444;
}

body.dark-mode .modal-header {
    background-color: #333;
    border-bottom-color: #444;
}

body.dark-mode .modal-title {
    color: #e0e0e0;
}

body.dark-mode .modal-footer {
    background-color: #333;
    border-top-color: #444;
}

body.dark-mode .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Pantalla de carga en modo oscuro */
body.dark-mode #loadingScreen {
    background: linear-gradient(135deg, #1e3a5f 0%, #15283d 100%);
}

body.dark-mode .loading-content {
    background-color: rgba(43, 43, 43, 0.95);
    border-color: #444;
}

body.dark-mode .loading-header h1 {
    color: #5a9fd4;
}

body.dark-mode .loading-header p {
    color: #b8b8b8;
}

body.dark-mode .instruction-card {
    background-color: #333;
    border-color: #444;
}

body.dark-mode .instruction-card h3 {
    color: #5a9fd4;
}

body.dark-mode .instruction-card p {
    color: #c0c0c0;
}

body.dark-mode .progress-bar-custom {
    background-color: #333;
}

body.dark-mode .progress-fill {
    background: linear-gradient(90deg, #3d5a80, #5a9fd4);
}

body.dark-mode .loading-status {
    color: #b8b8b8;
}

/* Switch de modo oscuro (custom styling) */
body.dark-mode .form-check-input:checked {
    background-color: #5a9fd4;
    border-color: #5a9fd4;
}

body.dark-mode .form-check-input {
    border-color: #555;
    background-color: #3a3a3a;
}

body.dark-mode .form-check-label {
    color: #d0d0d0;
}

/* Minimapa en modo oscuro */
body.dark-mode #minimapa {
    border-color: #5a9fd4;
    box-shadow: 0 0 10px rgba(90, 159, 212, 0.3);
}

/* Barra de control del canvas en modo oscuro */
body.dark-mode #canvasControlBar {
    background: rgba(43, 43, 43, 0.95);
    border: 1px solid #444;
    backdrop-filter: blur(10px);
}

body.dark-mode #controlBar .btn {
    color: #e0e0e0;
}

body.dark-mode #controlBar .form-label {
    color: #c0c0c0;
}

body.dark-mode #controlBar .badge {
    background-color: #3d5a80 !important;
    color: #fff;
}

/* Botones específicos de la barra de control */
body.dark-mode #controlBar .btn-info {
    background-color: #2d4a5a;
    border-color: #2d4a5a;
    color: #e0e0e0;
}

body.dark-mode #controlBar .btn-info:hover {
    background-color: #3d6a7a;
    border-color: #3d6a7a;
}

body.dark-mode #controlBar .btn-secondary {
    background-color: #4a4a4a;
    border-color: #4a4a4a;
    color: #e0e0e0;
}

body.dark-mode #controlBar .btn-secondary:hover {
    background-color: #5a5a5a;
    border-color: #5a5a5a;
}

body.dark-mode #controlBar .btn-success {
    background-color: #2d5a3d;
    border-color: #2d5a3d;
    color: #e0e0e0;
}

body.dark-mode #controlBar .btn-success:hover {
    background-color: #3d7a4d;
    border-color: #3d7a4d;
}

body.dark-mode #controlBar .btn-danger {
    background-color: #8b3838;
    border-color: #8b3838;
    color: #e0e0e0;
}

body.dark-mode #controlBar .btn-danger:hover {
    background-color: #b84848;
    border-color: #b84848;
}

body.dark-mode #controlBar .btn-warning {
    background-color: #8b6f38;
    border-color: #8b6f38;
    color: #e0e0e0;
}

body.dark-mode #controlBar .btn-warning:hover {
    background-color: #b89f48;
    border-color: #b89f48;
}

/* Range sliders en modo oscuro */
body.dark-mode #controlBar .form-range {
    background-color: transparent;
}

body.dark-mode #controlBar .form-range::-webkit-slider-track {
    background-color: #555;
}

body.dark-mode #controlBar .form-range::-webkit-slider-thumb {
    background-color: #5a9fd4;
}

body.dark-mode #controlBar .form-range::-moz-range-track {
    background-color: #555;
}

body.dark-mode #controlBar .form-range::-moz-range-thumb {
    background-color: #5a9fd4;
}

/* Botones de acordeón - forzar color de texto */
body.dark-mode .btn-info,
body.dark-mode .btn-primary,
body.dark-mode .btn-success,
body.dark-mode .btn-warning,
body.dark-mode .btn-danger {
    color: #e0e0e0 !important;
}

body.dark-mode .btn-info:hover,
body.dark-mode .btn-primary:hover,
body.dark-mode .btn-success:hover,
body.dark-mode .btn-warning:hover,
body.dark-mode .btn-danger:hover {
    color: #ffffff !important;
}

/* Botones outline en modo oscuro */
body.dark-mode .btn-outline-info {
    color: #5a9fd4;
    border-color: #5a9fd4;
}

body.dark-mode .btn-outline-info:hover {
    background-color: #2d4a5a;
    border-color: #3d6a7a;
    color: #e0e0e0;
}

body.dark-mode .btn-outline-primary {
    color: #5a9fd4;
    border-color: #5a9fd4;
}

body.dark-mode .btn-outline-primary:hover {
    background-color: #3d5a80;
    border-color: #5a9fd4;
    color: #e0e0e0;
}

body.dark-mode .btn-outline-secondary {
    color: #888;
    border-color: #555;
}

body.dark-mode .btn-outline-secondary:hover {
    background-color: #4a4a4a;
    border-color: #5a5a5a;
    color: #e0e0e0;
}

/* Tablas y gráficas (si hay) en modo oscuro */
body.dark-mode table {
    color: #d0d0d0;
    border-color: #444;
}

body.dark-mode table thead {
    background-color: #333;
    color: #e0e0e0;
}

body.dark-mode table tbody tr {
    background-color: #2b2b2b;
    border-color: #444;
}

body.dark-mode table tbody tr:hover {
    background-color: #353535;
}

/* Cards en modo oscuro */
body.dark-mode .card {
    background-color: #2b2b2b;
    border-color: #444;
    color: #d0d0d0;
}

body.dark-mode .card-body {
    color: #d0d0d0;
}

body.dark-mode .card-title {
    color: #e0e0e0;
}

body.dark-mode .card-text {
    color: #c0c0c0;
}

/* Cards con bordes de colores en modo oscuro */
body.dark-mode .card.border-primary {
    border-color: #5a9fd4 !important;
}

body.dark-mode .card.border-success {
    border-color: #3d7a4d !important;
}

body.dark-mode .card.border-danger {
    border-color: #b84848 !important;
}

body.dark-mode .card.border-warning {
    border-color: #b89f48 !important;
}

body.dark-mode .card.border-info {
    border-color: #3d6a7a !important;
}

/* Títulos de cards con colores en modo oscuro */
body.dark-mode .card-title.text-primary {
    color: #5a9fd4 !important;
}

body.dark-mode .card-title.text-success {
    color: #6dc98d !important;
}

body.dark-mode .card-title.text-danger {
    color: #e88888 !important;
}

body.dark-mode .card-title.text-warning {
    color: #e8c888 !important;
}

body.dark-mode .card-title.text-info {
    color: #6db8d4 !important;
}

/* Listas dentro de cards en modo oscuro */
body.dark-mode .card ul li {
    color: #c0c0c0;
}

body.dark-mode .card ul li strong {
    color: #e0e0e0;
}

/* Cards con bg-light en modo oscuro */
body.dark-mode .card.bg-light {
    background-color: #2b2b2b !important;
    border-color: #444;
}

body.dark-mode .card.bg-light .card-title {
    color: #e0e0e0;
}

body.dark-mode .card.bg-light .card-body {
    color: #d0d0d0;
}

/* Gráficas y Chart containers en modo oscuro */
body.dark-mode .chart-container {
    background-color: #2b2b2b;
    border-color: #444;
}

body.dark-mode .chart-container h6 {
    color: #e0e0e0;
}

body.dark-mode .chart-container:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

/* Pre y Code en modo oscuro */
body.dark-mode pre {
    background-color: #1e1e1e !important;
    border: 1px solid #444;
    color: #d4d4d4;
}

body.dark-mode pre code {
    color: #d4d4d4;
}

body.dark-mode code {
    background-color: #2d2d2d;
    color: #e8c888;
    padding: 2px 6px;
    border-radius: 3px;
}

/* ==================== PANEL DE INTERPRETACIÓN DE MÉTRICAS ==================== */

.status-panel {
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s ease;
    border-left: 5px solid;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* Estados del panel */
.status-panel.status-optimo {
    background: linear-gradient(135deg, rgba(25, 135, 84, 0.1) 0%, rgba(25, 135, 84, 0.05) 100%);
    border-left-color: #198754;
}

.status-panel.status-moderado {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.1) 0%, rgba(255, 193, 7, 0.05) 100%);
    border-left-color: #ffc107;
}

.status-panel.status-alto {
    background: linear-gradient(135deg, rgba(253, 126, 20, 0.1) 0%, rgba(253, 126, 20, 0.05) 100%);
    border-left-color: #fd7e14;
}

.status-panel.status-critico {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.1) 0%, rgba(220, 53, 69, 0.05) 100%);
    border-left-color: #dc3545;
}

.status-panel.status-bajo {
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.1) 0%, rgba(13, 110, 253, 0.05) 100%);
    border-left-color: #0d6efd;
}

/* Header del panel */
.status-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.status-emoji {
    font-size: 24px;
    line-height: 1;
}

.status-title {
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.5px;
}

/* Descripción del estado */
.status-description {
    font-size: 12px;
    color: #666;
    margin-bottom: 12px;
    line-height: 1.4;
}

/* Métricas en el panel */
.status-metrics {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.metric-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 4px;
}

.metric-label {
    font-weight: 600;
    min-width: 65px;
    color: #495057;
}

.metric-value {
    font-weight: 700;
    color: #212529;
    min-width: 55px;
}

.metric-desc {
    color: #6c757d;
    font-style: italic;
}

/* Observaciones */
.status-observations {
    border-top: 1px solid rgba(0,0,0,0.08);
    padding-top: 10px;
}

.observations-title {
    font-size: 11px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 6px;
}

.observation-item {
    font-size: 11px;
    color: #6c757d;
    line-height: 1.5;
    padding-left: 8px;
    margin-bottom: 3px;
}

/* Modo oscuro para el panel de estado */
body.dark-mode .status-panel {
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

body.dark-mode .status-panel.status-optimo {
    background: linear-gradient(135deg, rgba(25, 135, 84, 0.15) 0%, rgba(25, 135, 84, 0.08) 100%);
}

body.dark-mode .status-panel.status-moderado {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.15) 0%, rgba(255, 193, 7, 0.08) 100%);
}

body.dark-mode .status-panel.status-alto {
    background: linear-gradient(135deg, rgba(253, 126, 20, 0.15) 0%, rgba(253, 126, 20, 0.08) 100%);
}

body.dark-mode .status-panel.status-critico {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.15) 0%, rgba(220, 53, 69, 0.08) 100%);
}

body.dark-mode .status-panel.status-bajo {
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.15) 0%, rgba(13, 110, 253, 0.08) 100%);
}

body.dark-mode .status-description {
    color: #b0b0b0;
}

body.dark-mode .metric-item {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .metric-label {
    color: #c0c0c0;
}

body.dark-mode .metric-value {
    color: #e0e0e0;
}

body.dark-mode .metric-desc {
    color: #909090;
}

body.dark-mode .observations-title {
    color: #c0c0c0;
}

body.dark-mode .observation-item {
    color: #909090;
}